package com.dss.sdk.utils.crypt;

/**
 * @author: Fadada
 */
public class HexUtil {
    /**
     * 将字节数组转换为十六进制字符串。
     *
     * @param data 要转换的字节数组
     * @return 十六进制字符串
     */
    public static String printHexBinary(byte[] data) {
        StringBuilder hexBuilder = new StringBuilder();
        for (byte b : data) {
            String hex = Integer.toHexString(0xff & b);
            if (hex.length() == 1) {
                hexBuilder.append('0');
            }
            hexBuilder.append(hex);
        }
        return hexBuilder.toString();
    }
}
